from django.db import models

# Create your models here.
class MinuteLineDate(models.Model):
    # 主键
    id = models.AutoField(primary_key=True)
    # 股票代码
    tscode = models.CharField(max_length=20)
    # 开始时间
    startTime = models.CharField(max_length=50)
    # 结束时间
    endTime = models.CharField(max_length=50)
    # macd f
    macdF = models.CharField(max_length=20)
    # macd sl
    macdSL = models.CharField(max_length=20)
    # macd si
    macdSI = models.CharField(max_length=20)
    # 买参数
    buy = models.CharField(max_length=20)
    # 卖
    sell = models.CharField(max_length=20)
    # 买入时间
    buyTime = models.CharField(max_length=20)
    # 卖出时间
    sellTime = models.CharField(max_length=20)
    # 买入价格
    buyPrice = models.CharField(max_length=20)
    # 卖出价格
    sellPrice = models.CharField(max_length=20)
    # 交易获利
    tradProfit = models.FloatField()
    # tradProfit = models.DecimalField('tradProfit', decimal_places=2, max_digits=8)
    # 成功率
    successRatio = models.FloatField()

    #盈利率
    profitability = models.FloatField()

    # successRatio = models.DecimalField('successRatio', max_digits=8, decimal_places=

#交易详情
class MinuteLineDetail(models.Model):
    # 主键
    id = models.AutoField(primary_key=True)
    # 外键 TusharDate
    minuteLineDate = models.ForeignKey(MinuteLineDate, on_delete=models.CASCADE)
    # 股票代码
    tscode = models.CharField(max_length=20)
    # 买入时间
    buyTime = models.CharField(max_length=20)
    # 卖出时间
    sellTime = models.CharField(max_length=20)
    # 买入价格
    buyPrice = models.FloatField()
    # 卖出价格
    sellPrice = models.FloatField()
    # 交易获利
    tradProfit = models.FloatField()
    # 盈利率
    profitability = models.FloatField()
    # tradProfit = models.DecimalField('tradProfit', decimal_places=2, max_digits=8)

    # 交易详情
    class Ssq(models.Model):
        # 主键
        id = models.AutoField(primary_key=True)
        # 期号

        code = models.CharField(max_length=20)
        #红球1
        red1 = models.IntegerField()


        # 红球2
        red2 = models.IntegerField()
        # 红球3
        red3 = models.IntegerField()
        # 红球4
        red4 = models.IntegerField()
        # 红球5
        red5 = models.IntegerField()
        # 红球6
        red6 = models.IntegerField()
        # 蓝球
        blue = models.IntegerField()
